package jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class JDBCDemo1 {
    public static void main(String[] args) {
        try {
            Connection connection = DBUtil.getConnection();
            System.out.println("与数据库建立链接！");
            Statement statement = connection.createStatement();
            String sql = "CREATE TABLE userinfo(" +
                    "id INT PRIMARY KEY AUTO_INCREMENT," +
                    "username VARCHAR(32)," +
                    "password VARCHAR(32)," +
                    "nickname VARCHAR(32)," +
                    "age INT(3)" +
                    ");";
            statement.execute(sql);
            System.out.println("表创建成功");
            connection.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
